﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;

public partial class Manage_GetSubCategory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Request.QueryString["Language"] != null && Request.QueryString["iCategoryID"] != null)
        {
            string Language = Request.QueryString["Language"].ToString();
            int iCategoryID = Convert.ToInt32(Request.QueryString["iCategoryID"]);
          
            //int  iCategoryID = 0 ;
            //string  Language = "cn";
            string json = "json={\"Rows\":[";

            Dcms.BLL.Dcms_CateBLL bdcb = new Dcms.BLL.Dcms_CateBLL();
            DataSet ds = bdcb.GetSubCategory(iCategoryID, Language);
            /// {"Rows:{"FirstName":"Truly","LastName":"Zhu"}};
            /// Cate_ID,Cate_Name,Cate_ParentID,Cate_magstate,Cate_Order,Cate_Lang,Cate_Flag,Cate_OpType,Cate_IsChild 

            if (ds != null && ds.Tables[0] != null)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    json += "{\"Cate_ID\":" + dr["Cate_ID"].ToString() + ",\"Cate_Name\":\"" + dr["Cate_Name"].ToString() + "\",\"Cate_ParentID\":" + dr["Cate_ParentID"].ToString() + ",\"Cate_Order\":" + dr["Cate_Order"].ToString() + ",\"Cate_Lang\":\"" + dr["Cate_Lang"].ToString() + "\",\"Cate_OpType\":\"" + dr["Cate_OpType"].ToString() + "\",\"Cate_IsChild\":" + dr["Cate_IsChild"].ToString() + "},";
                }

            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                json = json.Substring(0, json.Length - 1);
            }
            json += "]};";
            //context.Response.ContentType = "text/plain";
            Response.Write(json);
         //   Response.Close();
        }
    }
}
